package service

import (
	"context"
	"go-pan/internal/model"
	"go-pan/internal/repository"
)

type ShareService interface {
	Create(ctx context.Context, share *model.FileShare) error
	FindByToken(ctx context.Context, token string) (*model.FileShare, error)
}

type shareService struct {
	repo repository.ShareRepository
}

func NewShareService(repo repository.ShareRepository) ShareService {
	return &shareService{repo: repo}
}

func (s *shareService) Create(ctx context.Context, share *model.FileShare) error {
	return s.repo.Create(ctx, share)
}

func (s *shareService) FindByToken(ctx context.Context, token string) (*model.FileShare, error) {
	return s.repo.FindByToken(ctx, token)
}
